import request from '@/utils/request'

/**
 * 提交审核
 * @return
 * @param data
 */
export function submitAudit(data) {
  return request({
    url: '/gene/drug/explain/submitAudit', method: 'post', data: data
  })
}

/**
 * 药物用药交代保存意见
 * @return
 * @param data
 */
export function saveAuditOpinion(data) {
  return request({
    url: '/gene/drug/explain/saveAuditOpinion', method: 'post', data: data
  })
}

// 查询已完成用药交代管理列表
export function listExplain(query) {
  return request({
    url: '/gene/drug/explain/list', method: 'get', params: query
  })
}

/**
 * 查询api是否存在用药交代记录
 * @param apiId
 * @returns {AxiosPromise}
 */
export function hasMedicationDisclosureApi(apiId) {
  return request({
    url: `/gene/drug/explain/hasMedicationDisclosureApi/${apiId}`, method: 'get'
  })
}

/**
 * 查询制剂是否存在用药交代记录
 * @param id
 */
export function explainSample(id) {
  return request({
    url: '/gene/drug/explain/selectSample/' + id, method: 'get'
  })
}

// 查询已完成用药交代样本列表
export function listSample(query) {
  return request({
    url: '/gene/drug/explain/listSample', method: 'get', params: query
  })
}

// 查询用药交代管理列表
export function listApiExplain(query) {
  return request({
    url: '/gene/drug/explain/listApiExplain', method: 'get', params: query
  })
}

// 批量药物API药物用药交代
export function updateExplainApiAll(data) {
  return request({
    url: '/gene/drug/explain/updateExplainApiAll', method: 'post', data: data
  })
}

// 删除药物用药交代
export function deleteExplainRelation(data) {
  return request({
    url: '/gene/drug/explain/deleteRelation', method: 'post', data: data
  })
}

// 修改用药交代
export function updateExplain(data) {
  return request({
    url: '/gene/drug/explain/update', method: 'post', data: data
  })
}

// 获取用药交代
export function getExplain(data) {
  return request({
    url: '/gene/drug/explain/getExplain', method: 'post', data: data
  })
}
